package org.word.utils;

import java.util.Map;

import com.fasterxml.jackson.core.JsonProcessingException;

/**
 * @author admin
 */
public class RequestUtils {

    public static void validateRequestKey(Map<String, Map> content) throws JsonProcessingException {
		Map<String, Map> applicationJson = content.get("application/json");
        if (applicationJson == null) {
        	throw new JsonProcessingException("content字段 缺少 application/json 字段") {};
        }

        Map<String, Map> schema = applicationJson.get("schema");
        if (schema == null) {
        	throw new JsonProcessingException("content字段 application/json 缺少 schema 字段") {};
        }

        if (schema.get("type") == null) {
        	throw new JsonProcessingException("content字段 application/json 字段 schema 字段 缺少 type字段") {};
        }
    }
}
